package com.xc.controller;

import com.xc.common.ServerResponse;
import com.xc.service.ISmsService;
import com.xc.utils.sms.ali.AliyunSmsConst;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *      公用 发送短信controller
 * @author xiongcan
 * @version 1.0
 * @date 2018/9/24 下午4:26
 */
@Controller
@RequestMapping("/api/sms/")
@Slf4j
public class SmsApiController {

    @Autowired
    ISmsService iSmsService;

    //  发送手机注册短信
    @RequestMapping("sendRegSms.do")
    @ResponseBody
    public ServerResponse sendRegSms(String phoneNum){
        return iSmsService.sendAliyunSMS(phoneNum
                , AliyunSmsConst.SmsTemplate.REG_TEMPLATE_CODE);
    }


    //  发送找回密码短信
    @RequestMapping("sendForgetSms.do")
    @ResponseBody
    public ServerResponse sendForgetSms(String phoneNum){
        return iSmsService.sendAliyunSMS(phoneNum
                , AliyunSmsConst.SmsTemplate.UPDATE_PWD_TEMPLATE_CODE);
    }



}
